//
//  BVHomeRouter.m
//  AFNetworking
//
//  Created by 崔晋 on 2019/8/14.
//

#import "BVHomeRouter.h"
#import "BVHomeViewController.h"
#import "BVPersonalViewController.h"
#import "BVPlayGroundViewController.h"
#import "BVFavoriteViewController.h"
#import "BVImagePickerVideoViewController.h"

@implementation BVHomeRouter

+ (void)load {
    [[BVRouterUtil shareInstance] addRouter:[[BVHomeRouter alloc] init] moduleName:@"home"];
}

- (UIViewController *)viewControllerWithPageName:(NSString *)pageName properties:(nonnull NSDictionary *)properties{
    if ([pageName isEqualToString:@"home_page"]) {
        BVHomeViewController *homeVC = [[BVHomeViewController alloc] init];
        return homeVC;
    }
    if ([pageName isEqualToString:@"play_ground"]) {
        BVPlayGroundViewController *homeVC = [[BVPlayGroundViewController alloc] initWithNibName:@"BVPlayGroundViewController" bundle:[BVBundle bundleWithClass:self.class name:BV_BUNDLE_HOME_SCENE_MODULE]];
        return homeVC;
    }
    if ([pageName isEqualToString:@"favorite"]) {
        BVFavoriteViewController *homeVC = [[BVFavoriteViewController alloc] initWithNibName:@"BVFavoriteViewController" bundle:[BVBundle bundleWithClass:self.class name:BV_BUNDLE_HOME_SCENE_MODULE]];
        return homeVC;
    }
    if ([pageName isEqualToString:@"personal"]) {
        BVPersonalViewController *homeVC = [[BVPersonalViewController alloc] initWithNibName:@"BVPersonalViewController" bundle:[BVBundle bundleWithClass:self.class name:BV_BUNDLE_HOME_SCENE_MODULE]];
        return homeVC;
    }
    if ([pageName isEqualToString:@"qrcode_actual"]) {
        BVImagePickerVideoViewController *vc = [[BVImagePickerVideoViewController alloc] init];
        id<UIImagePickerControllerDelegate> delegate = properties[@"delegate"];
        vc.delegate = delegate;
        return vc;
    }
    return nil;
}

@end
